package main

import (
	"github.com/gin-gonic/gin"
	controller2 "main/service/commentService/controller"
	controller4 "main/service/publishService/controller"
	controller5 "main/service/relationService/controller"
	controller3 "main/service/userService/controller"
	"net/http"
)

func InitRouter(r *gin.Engine) {
	// public directory is used to serve static resources
	r.Static("/static", "./public")
	r.StaticFS("/public", http.Dir("public"))
	r.StaticFile("/favicon.ico", "./static/favicon.ico")

	apiRouter := r.Group("/douyin")

	// basic apis
	apiRouter.GET("/feed/", controller3.Feed)
	apiRouter.GET("/user/", controller3.UserInfo)
	apiRouter.POST("/user/register/", controller3.Register)
	apiRouter.POST("/user/login/", controller3.Login)
	apiRouter.POST("/publish/action/", controller4.Publish)
	apiRouter.GET("/publish/list/", controller4.PublishList)

	// extra apis - I
	apiRouter.POST("/favorite/action/", controller3.FavouriteAction)
	apiRouter.GET("/favorite/list/", controller3.FavoriteList)
	apiRouter.POST("/comment/action/", controller2.CommentAction)
	apiRouter.GET("/comment/list/", controller2.CommentList)

	// extra apis - II
	apiRouter.POST("/relation/action/", controller5.RelationAction)
	apiRouter.GET("/relation/follow/list/", controller5.FollowList)
	apiRouter.GET("/relation/follower/list/", controller5.FollowerList)
}
